'''
python 函数
'''

def printf():
    print('hello world!\r\n')


def add(a,b,c):
    print("a:{},b:{},c:{}".format(a,b,c))
    return a+b+c

sum = add(1,2,3.4)
print("sum:{}".format(sum))

# printf()

# 自动带参数的函数
if 0:
        
    def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):
        print("-- This parrot wouldn't", action)
        print("if you put", voltage, "volts through it.")
        print("-- Lovely plumage, the", type)
        print("-- It's", state, "!")

    parrot(voltage=1000)      # 1 keyword argument



# 可变参数

def added(*args):
    sum = 0
    for x in args:
        sum +=x
    return sum
 
print( "num:{}".format(added(2,6,9,1.1)) )
